<template>
   <div class="todoFooter">
        <div>
            <input type="checkbox" @change="checkItemIsSelect" v-model="isCheck"">
            <span>已完成{{complated}}/全部{{returnAll}}</span>
        </div>
        <div>
            <button @click="ClearTaskName">清除已完成的任务</button>
        </div>
      </div>
</template>
<script>
export default {
    Name:"MyFooter",
    data() {
        return {
            isCheck:false
        }
    },
    props:['todoList','clearComplatedTask','controlBoxIsItem'],
    computed:{
        returnAll(){
            return this.todoList.length
        },
        complated(){
            const list = this.todoList.filter((item)=>{
                return item.IsOk
            })
            return list.length
        }
    },
    methods: {
        ClearTaskName(){
            this.$emit('clearComplatedTask')
        },
        checkItemIsSelect(){
            this.$emit('controlBoxIsItem',this.isCheck)
        }
    },
}
</script>
<style>
     /* ##Footer */
    .todoFooter{
        width: 780px;
        height: 90px;
        display: inline-flex;
        align-items: center;
        justify-content: space-between; /* 两端对齐 */
    }

    .todoFooter div input{
        margin-left: 20px;
        margin-right: 20px;
    }

    .todoFooter div button{
        height: 40px;
        color: white;
        background-color: #e25050;
        border:1px solid salmon;
        border-radius: 3px;
    }
</style>